package com.forever.toolAndAgent;

import dev.langchain4j.agent.tool.Tool;
import lombok.Data;
import org.springframework.stereotype.Component;

import java.util.ArrayList;
import java.util.List;

@Component
public class Calculator {
    @Tool(value = "计算两个数的和",name="add")
    public int add(int a, int b) {
        System.out.println("Called add with a=" + a + ", b=" + b);
        return a + b;
    }

    @Tool(value = "获取客户的信息",name="getUser")
    public List<User> getUser() {
        User user = new User();
        user.setAge(18);
        user.setName("张三");
        user.setPassword("123456");
        user.setUserId("sdf1231124eqqeqw");
        AiResult aiResult = new AiResult();
        List<User> userList = new ArrayList<>();
        userList.add(user);
        return userList;
    }

    @Data
    public static class User{
        private String name;
        private int age;
        private String userId;
        private String password;
    }
}
